import pandas as pd
pd.options.mode.chained_assignment = None # default warn => SettingWithCopyWarning
import numpy as np
import matplotlib.pyplot as plt
import bokeh
from collections import namedtuple
from pprint import (pprint as pp, pformat as pf)
import time
import warnings
warnings.simplefilter(action='ignore', category=UserWarning)
from IPython.display import HTML, display
import ipywidgets as widgets
import arrow
import dmyplant2
dmyplant2.cred()
mp = dmyplant2.MyPlant(3600)
from ipywidgets import AppLayout, Button, Layout, VBox, HBox, Label, HTML
from dfsm import msgFSM
def sfun(x):
return all([
("Forsa Hartmoor" in str(x['IB Site Name'])),
(x['OperationalCondition'] != 'Decommissioned')
])
fleet = mp.search_installed_fleet(sfun).drop('index', axis=1)
fleet = fleet.sort_values(by = "Engine ID",ascending=True).reset_index(drop='index')
fleet.T;
pname = 'persist.json'
try:
persist_dialog = dmyplant2.load_json(pname)
except FileNotFoundError:
persist_dialog = {
'dl': 0,
'modes': [
{'name':'???','value':False },
{'name':'OFF','value':False },
{'name':'MANUAL','value':False},
{'name':'AUTO','value':True }],
'starts': [
{'name':'True','value':True },
{'name':'False','value':False }]
}
dmyplant2.save_json(pname,persist_dialog)
# Dialog
ddl = pd.DataFrame(fleet['serialNumber'] + ' - ' + fleet['IB Site Name'] + ' ' + fleet['Engine ID'])[0].to_list()
ddl = [(m, i) for i, m in enumerate(ddl)]
#dl=widgets.Dropdown(options = ddl,value=0,description='Engine:',layout={'width':'max-content'},disabled=False)
dl=widgets.Dropdown(options = ddl,value=persist_dialog['dl'],description='Engine:',layout={'width':'auto'},disabled=False)
out = widgets.Output(layout={'height':'auto', 'width':'auto'})
rmodes = persist_dialog['modes']
service_selector_modes = []
modes = []
for mm in rmodes:
service_selector_modes.append(widgets.Checkbox(
value=mm['value'],
description=mm['name'],
layout={'width':'auto'},
disabled=False,indent=False))
rsucc = persist_dialog['starts']
successful_starts = [];
for rs in rsucc:
successful_starts.append(widgets.Checkbox(
value=rs['value'],
description=rs['name'],
layout={'width':'auto'},
disabled=False,indent=False))
app = AppLayout( header=dl,
#left_sidebar=Button(description='center', button_style='warning', layout=Layout(height='auto', width='auto')),
left_sidebar=None,
center=HBox([
VBox(service_selector_modes),
VBox(successful_starts),
out
]),
right_sidebar=None,
footer = None,
#footer = Button(description='footer', button_style='success', layout=Layout(height='auto', width='auto')),
pane_widths=['10px',1,'10px'],
pane_heights=['40px','250px','40px']
)
display(app)
AppLayout(children=(Dropdown(description='Engine:', index=7, layout=Layout(grid_area='header', width='auto'), …
# Load Engine Data and execute FSM Run 1 - display Results
persist_dialog = {'dl':dl.value, 'modes': [{'name':cb.description, 'value':cb.value} for cb in service_selector_modes],
'starts': [{'name':cb.description, 'value':cb.value} for cb in successful_starts]}
dmyplant2.save_json(pname,persist_dialog)
e=dmyplant2.Engine.from_fleet(mp,motor:=fleet.iloc[dl.value])
fsm = msgFSM(e, p_from=e['Commissioning Date'], p_to=arrow.now(), frompickle=True)
fsm.run1(enforce=False) # run Finite State Machine
fsm.store()
out.clear_output()
with out:
fsm.summary_out()
rdf = fsm.result
modes = [rmodes[i]['name'] for i,v in enumerate(service_selector_modes) if v.value]
success = [rsucc[i]['value'] for i,v in enumerate(successful_starts) if v.value]
rda = rdf[:].reset_index(drop='index')
rda['count_alarms'] = rda.apply(lambda x: len(x['alarms']), axis=1)
rda['count_warnings'] = rda.apply(lambda x: len(x['warnings']), axis=1)
rda = rda[(rda['mode'].isin(modes) & rda['success'].isin(success))]
display(HTML(pd.DataFrame.from_dict(e.dash, orient='index').T.to_html(escape=False, index=False)))
print(modes, success)
rda[fsm.filters['filter_content'] + fsm.filters['filter_alarms_and_warnings']].round(2)
HTML(value='<table border="1" class="dataframe">\n <thead>\n <tr style="text-align: right;">\n <th>Na…
['AUTO'] [True]
| success | mode | startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | targetoperation | count_alarms | count_warnings | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 3 | True | AUTO | 69.26 | 4.24 | 25.03 | 6.26 | 55.08 | 72.03 | 231.90 | 0 days 00:16:48 | 0 | 1 |
| 5 | True | AUTO | 60.62 | 3.64 | 19.17 | 5.54 | 54.95 | 56.74 | 200.66 | 0 days 00:00:30 | 0 | 0 |
| 6 | True | AUTO | 60.64 | 4.03 | 18.86 | 5.25 | 51.11 | 126.87 | 266.76 | 0 days 00:13:10 | 0 | 1 |
| 7 | True | AUTO | 102.40 | 3.74 | 23.45 | 6.37 | 50.24 | 129.06 | 315.27 | 0 days 00:07:16 | 0 | 0 |
| 8 | True | AUTO | 60.64 | 3.53 | 18.88 | 5.55 | 48.96 | 127.09 | 264.64 | 0 days 00:03:39 | 0 | 0 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 120 | True | AUTO | 99.79 | 3.83 | 24.41 | 4.84 | 59.45 | 87.62 | 279.94 | 0 days 05:13:30 | 0 | 0 |
| 121 | True | AUTO | 99.34 | 4.15 | 23.30 | 4.64 | 64.47 | 84.46 | 280.37 | 0 days 03:13:30 | 0 | 0 |
| 122 | True | AUTO | 103.73 | 3.84 | 23.71 | 4.74 | 48.64 | 97.30 | 281.96 | 0 days 01:43:30 | 0 | 0 |
| 123 | True | AUTO | 104.40 | 3.83 | 25.32 | 4.84 | 1.71 | 140.14 | 280.24 | 0 days 01:33:33 | 0 | 0 |
| 124 | True | AUTO | 103.33 | 4.14 | 20.39 | 4.44 | 47.54 | 99.57 | 279.41 | 0 days 03:33:33 | 0 | 0 |
67 rows × 12 columns
# Execute FSM Run 2
rda = fsm.run2(rda)
fsm.store()
FSM Run2: 100%|█████████████████████████| 67/67 [00:00<00:00, 15104.45 starts/s]
#rdb = rda
#rdb = rda[(rda['mode'].isin(['AUTO','MANUAL'])) & ((rda['count_alarms'] > 0) | (rda['count_warnings'] > 0))]
rdb = rda[rda['synchronize'] < 15.0]
rdb[fsm.filters['run2filter_content'] + fsm.filters['filter_alarms_and_warnings']].round(2)
| index | success | mode | startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation | count_alarms | count_warnings | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 10 | 17 | True | AUTO | 97.88 | 3.84 | 23.11 | 6.16 | 1.91 | 131.60 | 264.51 | 4519.11 | 0.76 | 0 days 05:17:18 | 0 | 1 |
| 18 | 26 | True | AUTO | 97.55 | 3.53 | 23.01 | 6.27 | 1.82 | 127.85 | 260.03 | 4503.96 | 0.78 | 0 days 00:30:48 | 0 | 1 |
| 20 | 28 | True | AUTO | 100.10 | 4.04 | 19.17 | 5.65 | 1.21 | 128.98 | 259.14 | 4505.97 | 0.78 | 0 days 03:30:50 | 0 | 0 |
| 25 | 33 | True | AUTO | 100.51 | 3.53 | 20.19 | 5.85 | 1.62 | 128.81 | 260.50 | 4509.47 | 0.78 | 0 days 00:30:46 | 0 | 1 |
| 31 | 43 | True | AUTO | 99.97 | 3.74 | 20.91 | 4.34 | 4.86 | 144.11 | 277.92 | 4493.31 | 0.69 | 0 days 00:33:33 | 0 | 0 |
| 32 | 48 | True | AUTO | 60.64 | 4.14 | 18.06 | 4.03 | 1.00 | 188.77 | 276.64 | 4470.92 | 0.53 | 0 days 00:04:18 | 0 | 1 |
| 33 | 50 | True | AUTO | 103.99 | 4.24 | 21.29 | 4.64 | 4.84 | 138.41 | 277.41 | 4510.91 | 0.73 | 0 days 00:33:31 | 0 | 1 |
| 34 | 51 | True | AUTO | 104.01 | 4.14 | 23.71 | 4.64 | 1.71 | 141.82 | 280.04 | 4512.00 | 0.71 | 0 days 01:33:29 | 0 | 0 |
| 35 | 52 | True | AUTO | 100.90 | 3.83 | 22.89 | 4.64 | 5.25 | 141.08 | 278.58 | 4510.00 | 0.71 | 0 days 00:33:31 | 0 | 0 |
| 36 | 53 | True | AUTO | 97.96 | 3.73 | 20.58 | 4.43 | 4.54 | 148.78 | 280.03 | 4499.00 | 0.67 | 0 days 00:48:37 | 0 | 0 |
| 37 | 54 | True | AUTO | 103.38 | 3.64 | 22.72 | 4.64 | 5.05 | 138.96 | 278.39 | 4494.47 | 0.72 | 0 days 01:03:13 | 0 | 0 |
| 38 | 56 | True | AUTO | 99.18 | 3.63 | 22.18 | 4.74 | 5.64 | 144.11 | 279.49 | 4508.00 | 0.70 | 0 days 02:18:31 | 0 | 1 |
| 39 | 57 | True | AUTO | 60.73 | 4.04 | 18.17 | 4.24 | 9.28 | 181.33 | 277.77 | 4490.76 | 0.55 | 0 days 04:04:10 | 0 | 1 |
| 40 | 58 | True | AUTO | 78.87 | 4.14 | 18.36 | 4.33 | 8.99 | 164.46 | 279.14 | 4488.00 | 0.61 | 0 days 00:18:52 | 0 | 1 |
| 41 | 59 | True | AUTO | 93.64 | 3.74 | 18.88 | 4.34 | 9.39 | 164.11 | 294.09 | 4507.00 | 0.61 | 0 days 04:33:38 | 0 | 1 |
| 42 | 60 | True | AUTO | 77.68 | 3.64 | 18.86 | 4.25 | 10.51 | 161.65 | 276.58 | 4457.07 | 0.61 | 0 days 00:10:48 | 0 | 0 |
| 43 | 61 | True | AUTO | 100.89 | 3.73 | 22.30 | 4.64 | 4.84 | 144.06 | 280.46 | 4499.00 | 0.69 | 0 days 01:03:32 | 0 | 0 |
| 44 | 62 | True | AUTO | 98.90 | 3.93 | 19.37 | 4.34 | 8.27 | 144.67 | 279.48 | 4505.00 | 0.69 | 0 days 00:33:29 | 0 | 1 |
| 45 | 64 | True | AUTO | 93.71 | 3.83 | 24.83 | 4.74 | 4.74 | 147.90 | 279.75 | 4504.00 | 0.68 | 0 days 03:43:36 | 0 | 1 |
| 46 | 65 | True | AUTO | 97.65 | 3.53 | 22.39 | 4.54 | 4.84 | 146.95 | 279.90 | 4508.00 | 0.68 | 0 days 01:33:34 | 0 | 1 |
| 47 | 72 | True | AUTO | 106.51 | 4.14 | 24.80 | 4.85 | 6.55 | 131.44 | 278.29 | 4488.46 | 0.76 | 0 days 00:23:29 | 0 | 1 |
| 48 | 73 | True | AUTO | 101.17 | 4.03 | 20.17 | 4.64 | 4.94 | 144.38 | 279.34 | 4518.72 | 0.70 | 0 days 01:03:34 | 0 | 0 |
| 49 | 74 | True | AUTO | 91.51 | 3.94 | 18.48 | 4.55 | 8.30 | 153.54 | 280.31 | 4500.00 | 0.65 | 0 days 00:43:42 | 0 | 0 |
| 50 | 75 | True | AUTO | 101.77 | 3.93 | 19.66 | 4.63 | 5.16 | 143.41 | 278.58 | 4494.00 | 0.70 | 0 days 00:53:34 | 0 | 1 |
| 51 | 76 | True | AUTO | 60.62 | 4.14 | 17.75 | 4.34 | 8.37 | 186.52 | 281.74 | 4496.67 | 0.54 | 0 days 00:54:17 | 0 | 1 |
| 52 | 77 | True | AUTO | 60.74 | 4.24 | 17.15 | 4.24 | 9.50 | 190.60 | 286.48 | 4484.00 | 0.52 | 0 days 00:24:11 | 0 | 1 |
| 53 | 86 | True | AUTO | 94.74 | 4.14 | 20.16 | 4.54 | 4.14 | 151.41 | 279.12 | 4501.00 | 0.66 | 0 days 02:43:42 | 0 | 1 |
| 54 | 87 | True | AUTO | 100.39 | 4.04 | 22.60 | 4.75 | 5.14 | 141.50 | 278.42 | 4510.54 | 0.71 | 0 days 00:05:46 | 0 | 2 |
| 55 | 88 | True | AUTO | 60.64 | 3.63 | 18.57 | 4.33 | 10.62 | 102.54 | 200.33 | 2729.34 | 0.59 | 0 days 00:01:39 | 0 | 0 |
| 56 | 89 | True | AUTO | 97.35 | 4.04 | 20.59 | 4.54 | 5.25 | 149.01 | 280.77 | 4508.00 | 0.67 | 0 days 01:23:37 | 0 | 0 |
| 57 | 91 | True | AUTO | 104.41 | 4.03 | 23.81 | 5.05 | 5.75 | 136.51 | 279.57 | 4502.69 | 0.73 | 0 days 00:33:32 | 0 | 0 |
| 65 | 123 | True | AUTO | 104.40 | 3.83 | 25.32 | 4.84 | 1.71 | 140.14 | 280.24 | 4507.82 | 0.72 | 0 days 01:33:33 | 0 | 0 |
display(_=rdb[['startpreparation','hochlauf','idle','synchronize','loadramp','maxload','ramprate','cumstarttime']].hist(bins=30,figsize=(20,20)))
display(rdb[['startpreparation','hochlauf','idle','synchronize','loadramp','maxload','ramprate','cumstarttime']].describe().round(2))
| startpreparation | hochlauf | idle | synchronize | loadramp | maxload | ramprate | cumstarttime | |
|---|---|---|---|---|---|---|---|---|
| count | 32.00 | 32.00 | 32.00 | 32.00 | 32.00 | 32.00 | 32.00 | 32.00 |
| mean | 92.26 | 20.94 | 4.71 | 5.49 | 147.79 | 4444.91 | 0.68 | 275.10 |
| std | 15.14 | 2.32 | 0.54 | 2.83 | 18.98 | 313.32 | 0.07 | 15.38 |
| min | 60.62 | 17.15 | 4.03 | 1.00 | 102.54 | 2729.34 | 0.52 | 200.33 |
| 25% | 93.10 | 18.87 | 4.34 | 4.44 | 138.82 | 4493.83 | 0.64 | 277.68 |
| 50% | 98.43 | 20.58 | 4.64 | 5.10 | 144.11 | 4503.32 | 0.69 | 279.13 |
| 75% | 100.96 | 22.76 | 4.75 | 8.27 | 151.94 | 4508.00 | 0.72 | 280.03 |
| max | 106.51 | 25.32 | 6.27 | 10.62 | 190.60 | 4519.11 | 0.78 | 294.09 |
# startversuch = rdb.iloc[1];
# von_dt=pd.to_datetime(startversuch['starttime']); von=int(von_dt.timestamp())
# bis_dt=pd.to_datetime(startversuch['endtime']); bis=int(bis_dt.timestamp())
# ftitle = f"{fsm._e} ----- Start {startversuch.name} {startversuch['mode']} | {'SUCCESS' if startversuch['success'] else 'FAILED'} | {startversuch['starttime'].round('S')}"
# print(ftitle, end=' ')
# print(f"von: {von_dt.strftime('%d.%m.%Y %H:%M:%S')} = {von} bis: {bis_dt.strftime('%d.%m.%Y %H:%M:%S')} = {bis}")
# vset = fsm._data_spec + ['Hyd_PressCrankCase','Hyd_PressOilDif','Hyd_PressOil','Hyd_TempOil']
# data = fsm.get_cycle_data(startversuch, max_length=None, min_length=None, cycletime=1, silent=False, p_data=vset)
# data
# dset = [
# {'col':['Power_PowerAct'], 'ylim':(0,5000), 'color':'red'},
# {'col':['Various_Values_SpeedAct'],'ylim': [0, 2500], 'color':'blue'},
# {'col':['Hyd_PressCrankCase'],'ylim': [-100, 100], 'color':'orange'},
# {'col':['Hyd_PressOilDif'],'ylim': [0, 2], 'color':'black'},
# {'col':['Hyd_PressOil'],'ylim': [0, 10], 'color':'brown'},
# {'col':['Hyd_TempOil'],'ylim': [0, 110], 'color':'#2171b5'}
# ]
# fsm.disp_result(startversuch)
# al_lines = fsm.disp_alarms(startversuch)
# w_lines = fsm.disp_warnings(startversuch)
# fig = dmyplant2.dbokeh_chart(data, dset, title=ftitle, figsize=(16,10), style='line', line_width=0)
# dmyplant2.add_dbokeh_vlines(al_lines,fig,line_color='purple', line_dash='dashed', line_alpha=1, line_width=2)
# dmyplant2.add_dbokeh_vlines(w_lines,fig,line_color='brown', line_dash='dashed', line_alpha=1, line_width=2)
# dmyplant2.add_dbokeh_vlines(fsm.states_lines(startversuch),fig,line_color='red', line_dash='solid', line_alpha=0.4)
# bokeh.plotting.show(fig)
# pure matplotlib chart
# fig, ax, axes = dmyplant2.chart(data, dset, figsize=(14,8), title=ftitle)
# dmyplant2.add_vlines(fsm.states_lines(startversuch), ax, color='gray', linestyle="-.")
# Edge detection algorithm speed - visualization
# dset = [
# {'col':['Various_Values_SpeedAct','Various_Values_SpeedAct_right'], 'ylim':(0,20000)},
# {'col':['helpline_right'], 'color':'gray','ylim':(0,20000)}
# ]
# # pr, _ = fsm.detect_edge_right(data, 'Various_Values_SpeedAct', right=startversuch['endtime'])
# # fig = dmyplant2.dbokeh_chart(data, dset, title=ftitle, figsize=(14,8), style='line', line_width=0)
# pr, ndata = fsm.detect_edge_right(data, 'Various_Values_SpeedAct', right=startversuch['endtime'])
# fig = dmyplant2.dbokeh_chart(ndata, dset, title=ftitle, figsize=(14,8), style='line', line_width=0)
# dmyplant2.add_dbokeh_vlines([pr.loc], fig,line_color='red', line_dash='solid', line_alpha=0.4)
# bokeh.plotting.show(fig)
# Edge detection algorithm speed - visualization
# dset = [
# {'col':['Various_Values_SpeedAct','Various_Values_SpeedAct_left','Various_Values_SpeedAct_right','helpline_left','helpline_right'], '_ylim':(0,4000)},
# ]
# pr, ndata = fsm.detect_edge_right(data, 'Various_Values_SpeedAct', right=startversuch['endtime'])
# pl, ndata = fsm.detect_edge_left(ndata, 'Various_Values_SpeedAct', left=startversuch['starttime'])
# fig = dmyplant2.dbokeh_chart(ndata, dset, title=ftitle, figsize=(14,8), style='line', line_width=0)
# # pl, _ = fsm.detect_edge_left(data, 'Various_Values_SpeedAct', left=startversuch['starttime'])
# # fig = dmyplant2.dbokeh_chart(data, dset, title=ftitle, figsize=(14,8), style='line', line_width=0)
# dmyplant2.add_dbokeh_vlines([pl.loc], fig,line_color='red', line_dash='solid', line_alpha=0.4)
# dmyplant2.add_dbokeh_vlines([pr.loc], fig,line_color='red', line_dash='solid', line_alpha=0.4)
# bokeh.plotting.show(fig)
# Edge detection algorithm power - visualization
dset = [
{'col':['Power_PowerAct','Power_PowerAct_left','Power_PowerAct_right'], '_ylim':(0,40000)}
]
#pl, _ = fsm.detect_edge_left(data, 'Power_PowerAct', left=startversuch['starttime'])
pl, _ = fsm.detect_edge_left(data, 'Power_PowerAct', startversuch=startversuch)
pr, _ = fsm.detect_edge_right(data, 'Power_PowerAct', right=startversuch['endtime'])
fig = dmyplant2.dbokeh_chart(data, dset, title=ftitle, figsize=(6,3), style='line', line_width=0)
dmyplant2.add_dbokeh_vlines([pl.loc], fig,line_color='red', line_dash='solid', line_alpha=0.4)
dmyplant2.add_dbokeh_vlines([pr.loc], fig,line_color='red', line_dash='solid', line_alpha=0.4)
bokeh.plotting.show(fig)
# # Edge detection algorithm power & speed - visualization
# dset = [
# {'col':['Power_PowerAct','Various_Values_SpeedAct'], 'ylim':(0,30000)},
# {'col':['Power_PowerAct_left','Power_PowerAct_right','Various_Values_SpeedAct_left', 'Various_Values_SpeedAct_right'], 'ylim':(0,30000)}
# ]
# pl, _ = fsm.detect_edge_left(data, 'Power_PowerAct', startversuch)
# pr, _ = fsm.detect_edge_right(data, 'Power_PowerAct', startversuch)
# sl, _ = fsm.detect_edge_left(data, 'Various_Values_SpeedAct', startversuch)
# sr, _ = fsm.detect_edge_right(data, 'Various_Values_SpeedAct', startversuch)
# #fig, ax, axes = dmyplant2.chart(data, dset, figsize=(14,8), title=ftitle)
# fsm.disp_result(startversuch)
# al_lines = fsm.disp_alarms(startversuch)
# w_lines = fsm.disp_warnings(startversuch)
# fig = dmyplant2.dbokeh_chart(data, dset, title=ftitle, figsize=(14,8), style='line', line_width=0)
# dmyplant2.add_dbokeh_vlines(al_lines,fig,line_color='purple', line_dash='dashed', line_alpha=1, line_width=2)
# dmyplant2.add_dbokeh_vlines(w_lines,fig,line_color='brown', line_dash='dashed', line_alpha=1, line_width=2)
# dmyplant2.add_dbokeh_vlines(fsm.states_lines(startversuch), fig,line_color='red', line_dash='solid', line_alpha=0.4)
# lcol='blue'
# dmyplant2.add_dbokeh_vlines([sl.loc], fig,line_color=lcol, line_dash='solid', line_alpha=0.4)
# dmyplant2.add_dbokeh_vlines([sr.loc], fig,line_color=lcol, line_dash='solid', line_alpha=0.4)
# dmyplant2.add_dbokeh_vlines([pl.loc], fig,line_color=lcol, line_dash='solid', line_alpha=0.4)
# dmyplant2.add_dbokeh_vlines([pr.loc], fig,line_color=lcol, line_dash='solid', line_alpha=0.4)
# bokeh.plotting.show(fig)
# iterate over Result
dset = [
{'col':['Power_PowerAct'], '_ylim':(0,5000), 'color':'red'},
{'col':['Various_Values_SpeedAct'],'_ylim': [0, 2500], 'color':'blue'},
{'col':['Hyd_PressCrankCase'],'_ylim': [-100, 100], 'color':'orange'},
{'col':['Hyd_PressOilDif'],'_ylim': [0, 2], 'color':'black'},
{'col':['Hyd_TempOil'],'_ylim': [60, 110], 'color':'#2171b5'}
]
def crawl_result(rda, srange = None, p_figsize=(16,10)):
if srange == None:
srange = [s['index'] for i,s in rda.iterrows()] # too much memory needed !!
#srange = [s for s in range(2)] # limit to 2 in the interim
else:
if isinstance(srange,int):
srange = [srange]
elif not isinstance(srange,list):
raise ValueError(f"crawl_result: invalid parameter! srange={srange}")
print(srange)
for ii,startversuch in rda.iterrows():
if startversuch['index'] in srange:
data = fsm.get_cycle_data(startversuch, max_length=None, min_length=None, cycletime=1, silent=True, p_data=fsm._data_spec + ['Hyd_PressCrankCase','Hyd_PressOilDif','Hyd_TempOil'])
print(data.shape)
pl, _ = fsm.detect_edge_left(data, 'Power_PowerAct', startversuch)
pr, _ = fsm.detect_edge_right(data, 'Power_PowerAct', startversuch)
sl, _ = fsm.detect_edge_left(data, 'Various_Values_SpeedAct', startversuch)
sr, _ = fsm.detect_edge_right(data, 'Various_Values_SpeedAct', startversuch)
# code ?
ml = (data.iloc[-1]['time'] - data.iloc[0]['time']) // 1000
sv_lines = [v for v in startversuch[fsm.filters['vertical_lines_times']]]
nsv_lines = [v for v in sv_lines if ((v==v) and (v <= ml)) ]
svdf = pd.DataFrame(sv_lines, index=fsm.filters['vertical_lines_times'], columns=['FSM']).fillna(0)
svdf['RUN2'] = svdf['FSM']
#if svdf.at['hochlauf','FSM'] > 0.0:
# svdf.at['hochlauf','RUN2'] = sl.loc.timestamp() - start.timestamp() - np.cumsum(svdf['RUN2'])['starter']
# svdf.at['idle','RUN2'] = svdf.at['idle','FSM'] - (svdf.at['hochlauf','RUN2'] - svdf.at['hochlauf','FSM'])
if svdf.at['loadramp','FSM'] > 0.0:
svdf.at['loadramp','RUN2'] = pl.loc.timestamp() - startversuch['starttime'].timestamp() - np.cumsum(svdf['RUN2'])['synchronize']
with warnings.catch_warnings():
warnings.simplefilter("ignore")
svdf = pd.concat([
svdf,
pd.DataFrame.from_dict(
{ 'maxload':['-',pl.val],
'ramp':['-',(pl.val / fsm._e['Power_PowerNominal']) * 100 / svdf.at['loadramp','RUN2']],
'cumstarttime':[np.cumsum(svdf['FSM'])['loadramp'], np.cumsum(svdf['RUN2'])['loadramp']]
},
columns=['FSM','RUN2'],
orient='index')]
)
ftitle = f"{fsm._e} ----- Start {startversuch['index']} {startversuch['mode']} | {'SUCCESS' if startversuch['success'] else 'FAILED'} | {startversuch['starttime'].round('S')}"
display(HTML('<h3>'+ f"{fsm._e} ----- Start {startversuch['index']} {startversuch['mode']} | {'SUCCESS' if startversuch['success'] else 'FAILED'} | {startversuch['starttime'].round('S')}" + '</h3>'))
fsm.disp_result(startversuch)
al_lines = fsm.disp_alarms(startversuch)
w_lines = fsm.disp_warnings(startversuch)
fig = dmyplant2.dbokeh_chart(data, dset, title=ftitle, figsize=p_figsize, style='line', line_width=0)
#fsm results
dmyplant2.add_dbokeh_vlines(fsm.states_lines(startversuch), fig,line_color='red', line_dash='solid', line_alpha=0.4)
#alarms & warnings
dmyplant2.add_dbokeh_vlines(al_lines,fig,line_color='purple', line_dash='dashed', line_alpha=1, line_width=2)
dmyplant2.add_dbokeh_vlines(w_lines,fig,line_color='brown', line_dash='dashed', line_alpha=1, line_width=2)
#fsm run 2 results
lcol='blue'
dmyplant2.add_dbokeh_vlines([sl.loc], fig,line_color=lcol, line_dash='solid', line_alpha=0.4)
dmyplant2.add_dbokeh_vlines([sr.loc], fig,line_color=lcol, line_dash='solid', line_alpha=0.4)
dmyplant2.add_dbokeh_vlines([pl.loc], fig,line_color=lcol, line_dash='solid', line_alpha=0.4)
dmyplant2.add_dbokeh_vlines([pr.loc], fig,line_color=lcol, line_dash='solid', line_alpha=0.4)
bokeh.plotting.show(fig)
print(f"Number of Starts in Result: {rdb.shape[0]}")
Number of Starts in Result: 32
#crawl_result(rda, [i for i in range(20,40)], p_figsize=(17,10))
crawl_result(rdb, p_figsize=(17,10))
[17, 26, 28, 33, 43, 48, 50, 51, 52, 53, 54, 56, 57, 58, 59, 60, 61, 62, 64, 65, 72, 73, 74, 75, 76, 77, 86, 87, 88, 89, 91, 123] (4490, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 17 AUTO | SUCCESS | 2022-01-11 10:40:13</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 97.882999 | 3.840999 | 23.108 | 6.156999 | 1.912999 | 131.604004 | 264.506 | 4519.112 | 0.763931 | 0 days 05:17:18 |
| state | severity | Number | date | message |
|---|---|---|---|---|
| loadramp | 700 | 2688 | 11.01.2022 10:42:34 | Generator current at synchronization too high |
(3911, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 26 AUTO | SUCCESS | 2022-01-15 08:28:05</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 97.550999 | 3.53 | 23.012 | 6.272999 | 1.820999 | 127.847003 | 260.034 | 4503.955 | 0.783743 | 0 days 00:30:48 |
| state | severity | Number | date | message |
|---|---|---|---|---|
| loadramp | 700 | 2688 | 15.01.2022 08:30:18 | Generator current at synchronization too high |
(4273, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 28 AUTO | SUCCESS | 2022-01-15 15:58:05</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 100.099 | 4.038 | 19.165999 | 5.648999 | 1.212 | 128.975002 | 259.139 | 4505.974 | 0.777237 | 0 days 03:30:50 |
(3911, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 33 AUTO | SUCCESS | 2022-01-17 15:28:06</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 100.507 | 3.531 | 20.188 | 5.851 | 1.617999 | 128.807001 | 260.502 | 4509.466 | 0.778854 | 0 days 00:30:46 |
| state | severity | Number | date | message |
|---|---|---|---|---|
| loadramp | 700 | 2688 | 17.01.2022 15:30:18 | Generator current at synchronization too high |
(3915, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 43 AUTO | SUCCESS | 2022-01-20 19:55:06</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 99.966 | 3.736 | 20.908999 | 4.344 | 4.856999 | 144.111002 | 277.923 | 4493.314274 | 0.693649 | 0 days 00:33:33 |
(2584, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 48 AUTO | SUCCESS | 2022-01-20 23:11:50</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 60.638999 | 4.137 | 18.060999 | 4.031 | 1.002999 | 188.774003 | 276.645 | 4470.915 | 0.526896 | 0 days 00:04:18 |
| state | severity | Number | date | message |
|---|---|---|---|---|
| loadramp | 700 | 2688 | 20.01.2022 23:13:19 | Generator current at synchronization too high |
(3915, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 50 AUTO | SUCCESS | 2022-01-21 09:55:06</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 103.994 | 4.236999 | 21.292999 | 4.644999 | 4.836 | 138.407003 | 277.412 | 4510.908 | 0.725064 | 0 days 00:33:31 |
| state | severity | Number | date | message |
|---|---|---|---|---|
| loadramp | 700 | 2688 | 21.01.2022 09:57:30 | Generator current at synchronization too high |
(4035, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 51 AUTO | SUCCESS | 2022-01-22 16:55:07</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 104.011 | 4.136999 | 23.713999 | 4.639 | 1.712 | 141.823002 | 280.036 | 4512.0 | 0.707771 | 0 days 01:33:29 |
(3915, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 52 AUTO | SUCCESS | 2022-01-23 11:55:07</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 100.895 | 3.832 | 22.894 | 4.64 | 5.245999 | 141.076001 | 278.583 | 4510.0 | 0.711203 | 0 days 00:33:31 |
(3945, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 53 AUTO | SUCCESS | 2022-01-23 17:10:08</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 97.961999 | 3.734 | 20.577999 | 4.435 | 4.539 | 148.778002 | 280.026 | 4499.0 | 0.672741 | 0 days 00:48:37 |
(3974, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 54 AUTO | SUCCESS | 2022-01-24 09:25:11</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 103.384 | 3.637 | 22.720999 | 4.644 | 5.045999 | 138.959002 | 278.391 | 4494.468 | 0.719552 | 0 days 01:03:13 |
(4125, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 56 AUTO | SUCCESS | 2022-01-25 06:55:04</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 99.176999 | 3.633 | 22.176 | 4.741999 | 5.645 | 144.114002 | 279.487 | 4508.0 | 0.695902 | 0 days 02:18:31 |
| state | severity | Number | date | message |
|---|---|---|---|---|
| loadramp | 700 | 2688 | 25.01.2022 06:57:23 | Generator current at synchronization too high |
(4335, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 57 AUTO | SUCCESS | 2022-01-25 09:25:04</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 60.728 | 4.038 | 18.166 | 4.235999 | 9.279 | 181.327001 | 277.774 | 4490.7648 | 0.55097 | 0 days 04:04:10 |
| state | severity | Number | date | message |
|---|---|---|---|---|
| startpreparation | 700 | 1195 | 25.01.2022 09:25:06 | Safety slam shut valve status signal failure |
(3486, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 58 AUTO | SUCCESS | 2022-01-25 13:55:04</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 78.865999 | 4.135 | 18.360999 | 4.334 | 8.987 | 164.461002 | 279.144 | 4488.0 | 0.6071 | 0 days 00:18:52 |
| state | severity | Number | date | message |
|---|---|---|---|---|
| loadramp | 700 | 2688 | 25.01.2022 13:56:59 | Generator current at synchronization too high |
(4395, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 59 AUTO | SUCCESS | 2022-01-25 14:55:04</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 93.637 | 3.74 | 18.877999 | 4.338 | 9.393999 | 164.107002 | 294.094 | 4507.0 | 0.610985 | 0 days 04:33:38 |
| state | severity | Number | date | message |
|---|---|---|---|---|
| loadramp | 700 | 2688 | 25.01.2022 14:57:14 | Generator current at synchronization too high |
(3001, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 60 AUTO | SUCCESS | 2022-01-25 19:55:06</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 77.680999 | 3.637999 | 18.86 | 4.249999 | 10.507 | 161.645003 | 276.581 | 4457.072 | 0.61342 | 0 days 00:10:48 |
(3975, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 61 AUTO | SUCCESS | 2022-01-26 07:25:05</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 100.892999 | 3.732999 | 22.295 | 4.640999 | 4.839 | 144.060003 | 280.461 | 4499.0 | 0.694773 | 0 days 01:03:32 |
(3915, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 62 AUTO | SUCCESS | 2022-01-26 09:55:05</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 98.896999 | 3.933999 | 19.366 | 4.343 | 8.266999 | 144.670003 | 279.477 | 4505.0 | 0.692766 | 0 days 00:33:29 |
| state | severity | Number | date | message |
|---|---|---|---|---|
| targetoperation | 700 | 2476 | 26.01.2022 10:33:03 | CAM/Reset pickup signal deviation during engine operation |
(4295, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 64 AUTO | SUCCESS | 2022-01-27 16:45:06</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 93.710999 | 3.828999 | 24.827 | 4.745 | 4.738999 | 147.903003 | 279.754 | 4504.0 | 0.677473 | 0 days 03:43:36 |
| state | severity | Number | date | message |
|---|---|---|---|---|
| loadramp | 700 | 2688 | 27.01.2022 16:47:23 | Generator current at synchronization too high |
(4035, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 65 AUTO | SUCCESS | 2022-01-28 07:25:06</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 97.648999 | 3.53 | 22.392 | 4.544 | 4.84 | 146.949001 | 279.904 | 4508.0 | 0.682476 | 0 days 01:33:34 |
| state | severity | Number | date | message |
|---|---|---|---|---|
| loadramp | 700 | 2688 | 28.01.2022 07:27:24 | Generator current at synchronization too high |
(3786, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 72 AUTO | SUCCESS | 2022-02-02 06:35:07</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 106.511 | 4.144 | 24.804 | 4.849 | 6.549999 | 131.436001 | 278.294 | 4488.456 | 0.759719 | 0 days 00:23:29 |
| state | severity | Number | date | message |
|---|---|---|---|---|
| loadramp | 700 | 2688 | 02.02.2022 06:37:37 | Generator current at synchronization too high |
(3975, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 73 AUTO | SUCCESS | 2022-02-02 10:55:06</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 101.171 | 4.032 | 20.166999 | 4.64 | 4.942 | 144.384001 | 279.336 | 4518.72 | 0.696252 | 0 days 01:03:34 |
(3935, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 74 AUTO | SUCCESS | 2022-02-02 12:35:07</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 91.507999 | 3.935 | 18.477 | 4.547999 | 8.298 | 153.540002 | 280.306 | 4500.0 | 0.652021 | 0 days 00:43:42 |
(3955, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 75 AUTO | SUCCESS | 2022-02-02 15:55:05</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 101.774999 | 3.934 | 19.664999 | 4.634 | 5.160999 | 143.412003 | 278.581 | 4494.0 | 0.697137 | 0 days 00:53:34 |
| state | severity | Number | date | message |
|---|---|---|---|---|
| hochlauf | 700 | 2476 | 02.02.2022 15:57:07 | CAM/Reset pickup signal deviation during engine operation |
(3955, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 76 AUTO | SUCCESS | 2022-02-02 17:05:05</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 60.618 | 4.135 | 17.753999 | 4.339 | 8.372999 | 186.523002 | 281.742 | 4496.672 | 0.536326 | 0 days 00:54:17 |
| state | severity | Number | date | message |
|---|---|---|---|---|
| loadramp | 700 | 2688 | 02.02.2022 17:06:43 | Generator current at synchronization too high |
(3785, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 77 AUTO | SUCCESS | 2022-02-02 18:05:08</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 60.741999 | 4.243 | 17.151 | 4.244 | 9.5 | 190.596001 | 286.476 | 4484.0 | 0.523386 | 0 days 00:24:11 |
| state | severity | Number | date | message |
|---|---|---|---|---|
| loadramp | 700 | 2688 | 02.02.2022 18:06:43 | Generator current at synchronization too high |
(4175, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 86 AUTO | SUCCESS | 2022-02-09 16:15:05</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 94.735 | 4.136 | 20.164 | 4.540999 | 4.138 | 151.410001 | 279.124 | 4501.0 | 0.66134 | 0 days 02:43:42 |
| state | severity | Number | date | message |
|---|---|---|---|---|
| loadramp | 700 | 2688 | 09.02.2022 16:17:19 | Generator current at synchronization too high |
(2722, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 87 AUTO | SUCCESS | 2022-02-10 11:01:13</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 100.392 | 4.039 | 22.598 | 4.752 | 5.144999 | 141.497001 | 278.423 | 4510.5437 | 0.709173 | 0 days 00:05:46 |
| state | severity | Number | date | message |
|---|---|---|---|---|
| hochlauf | 700 | 2476 | 10.02.2022 11:03:13 | CAM/Reset pickup signal deviation during engine operation |
| loadramp | 700 | 2688 | 10.02.2022 11:03:35 | Generator current at synchronization too high |
(2435, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 88 AUTO | SUCCESS | 2022-02-10 11:25:20</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 60.642 | 3.629999 | 18.567 | 4.331 | 10.621999 | 102.535002 | 200.327 | 2729.339939 | 0.592183 | 0 days 00:01:39 |
(4015, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 89 AUTO | SUCCESS | 2022-02-10 17:35:07</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 97.346 | 4.036 | 20.587 | 4.544999 | 5.245999 | 149.006002 | 280.766 | 4508.0 | 0.673055 | 0 days 01:23:37 |
(3915, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 91 AUTO | SUCCESS | 2022-02-14 18:55:05</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 104.412999 | 4.033999 | 23.812 | 5.048999 | 5.754 | 136.508003 | 279.57 | 4502.692 | 0.733811 | 0 days 00:33:32 |
(4035, 7)
HTML(value='<h3>1486144 Forsa Hartmoor M01 ----- Start 123 AUTO | SUCCESS | 2022-02-24 08:55:07</h3>')
| startpreparation | starter | hochlauf | idle | synchronize | loadramp | cumstarttime | maxload | ramprate | targetoperation |
|---|---|---|---|---|---|---|---|---|---|
| 104.403 | 3.831 | 25.322999 | 4.837 | 1.713999 | 140.136002 | 280.244 | 4507.82 | 0.715628 | 0 days 01:33:33 |
rda.describe().round(1).T
longer_than_300s = rda[fsm.filters['filter_period'] + fsm.filters['filter_content']][rda['cumstarttime'] > 300.0]
longer_than_300s[fsm.filters['filter_content']].round(2)
longer_than_300s.describe().round(2).T
load_ramp_less_than_100s = rdb[fsm.filters['filter_period'] + fsm.filters['run2filter_content']][(rdb['loadramp'] < 100.0) & (rdb['maxload'] > 4000.0)]
lfsm = load_ramp_less_than_100s[['starttime']+fsm.filters['run2filter_content']]
lfsm = lfsm.sort_values(by = "index",ascending=True).reset_index(drop='index').round(2)
lfsm
rdc = rdb[rdb.starttime > '2022-01-01']
dset = [
{'col':['ramprate'],'ylim':(-1,3)},
{'col':['cumstarttime'],'ylim':(0,900), 'color':'darkblue'},
{'col':['synchronize'],'ylim':(0,400)},
{'col':['startpreparation'],'ylim':(-100,200)},
{'col':['hochlauf'],'ylim':(0,100), 'color':'black'},
{'col':['maxload'],'ylim':(500,5500) }
]
ftitle = f"{fsm._e}"
fig = dmyplant2.dbokeh_chart(rdc, dset, x='starttime', figsize=(16,10) ,title=ftitle);
bokeh.plotting.show(fig)
dset = [
{'col':['ramprate'],'ylim':(0,1.5)},
{'col':['synchronize'],'ylim':(0,200)},
{'col':['cumstarttime'],'ylim':(0,400)},
{'col':['maxload'],'ylim':(0,5000) }
]
dmyplant2.chart(rdb, dset, x='starttime', figsize=(12,8), title=ftitle);
rda.reset_index(drop='index').iloc[10];
for i, r in load_ramp_less_than_100s.reset_index(drop='index').iterrows():
if i >= 2:
break
fsm.plot_cycle(r, max_length=8*60, ylim=(0,2500), cycletime=1, marker=None,figsize=(15,8), title=f"{i:3d} - {fsm._e} {r['starttime'].round('S')}")
plt.show()
load_ramp_less_than_100s.describe().round(2).T
rda[['startpreparation','starter','hochlauf','idle','synchronize','cumstarttime','loadramp','targetoperation']].hist(figsize = (20,12), bins=80, layout=(3,3));
#rda.hist(figsize = (20,12), bins=100, layout=(4,2));
nalarms = []
ct = 0
ct2 = 0
mini = 0
maxi = 100
for i,c in rdf.iterrows():
if len(c['alarms']) > 0 and not c['success']:
ct += 1
print(f"\nStartversuch: {i}, Success: {c['success']}")
for a in c['alarms']:
nalarms.append(a['msg'])
_txt = f"{ct2} {c['mode']:15} {a['state']:20} {a['msg']['timestamp']} {pd.to_datetime(int(a['msg']['timestamp'])*1e6).strftime('%d.%m.%Y %H:%M:%S')} {a['msg']['name']} {a['msg']['message']}"
print(_txt)
if ct2 >= mini and ct2 <= maxi:
fsm.plot_cycle(c, ylim=(0,2500), cycletime=1, marker=None,figsize=(20,12), title=f"{i:3d} - {fsm._e} {_txt}")
plt.show()
ct2 += 1
print(f"""
***********************************
** {ct:3} nicht erfolgreiche Starts **
***********************************
""")
al = pd.DataFrame(fsm._pareto(nalarms))
fig = plt.figure();
color = 'purple'
if not al.empty:
al['msg'] = al['msg'] + ' (' + al['name'] + ')'
al.set_index('msg').sort_values(by = "anz",ascending=True).plot.barh(y=['anz'],figsize=(16,len(al) / 3.8), color=[color], position = 1.0, grid=True, title='Alarms in not successful Starts');
plt.plot();
phases = [['startpreparation','starter','hochlauf','idle','synchronize','loadramp','targetoperation'],'startpreparation','starter','hochlauf','idle','synchronize','loadramp','targetoperation']
fig = plt.figure();
color = 'red'
for phase in phases:
al = fsm.alarms_pareto(phase)[:30]
if not al.empty:
al['msg'] = al['msg'] + ' (' + al['name'] + ')'
al.set_index('msg').sort_values(by = "anz",ascending=True).plot.barh(y=['anz'],figsize=(16,len(al) / 3.8), color=[color], position = 1.0, grid=True, title=' | '.join(phase) if type(phase) == list else phase);
plt.plot();
fig = plt.figure();
color = 'orange'
for phase in phases:
al = fsm.warnings_pareto(phase)[:30]
if not al.empty:
al['msg'] = al['msg'] + ' (' + al['name'] + ')'
al.set_index('msg').sort_values(by = "anz",ascending=True).plot.barh(y=['anz'],figsize=(16,len(al) / 3.8), color=[color], position = 1.0, grid=True, title=' | '.join(phase) if type(phase) == list else phase);
plt.plot();
mfn = e._fname + '_messages.txt'
fsm.save_messages(mfn)
print(mfn)
any(fsm._messages['name'] == '9047')
fsm._target_load_message
#fsm.store()